import { catelist } from '../../../request/api.js'
const state = {
    catelist: [],
    pid:0
}

const getters = {
    getCate(state) {
        return state.catelist
    }
}

const mutations = {
    REQ_LIST(state, payload) {
        state.catelist = payload
    }
}

const actions = {
    getCateAction(context) {
        catelist({
            pid:context.state.pid
        }).then(res => {
            if (res.code == 200) {
                context.commit('REQ_LIST', res.list?res.list : [])
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}